1 class FlatBezelCollectingSearchObjectView: QSCollectingSearchObjectView {
2 override static var cellClass : AnyClass? {
3 get { return BBObjectCell.self }
4 set { super.cellClass = newValue }
7 override func draw(_ rect: NSRect) {
10 // These properties aren't available to Swift, so they need to be accessed in this way.
11 let collection = (value(forKey: "collection") as! NSMutableArray)
12 let collecting = (value(forKey: "collecting") as! Bool)
14 let count = collection.count
15 if self.currentEditor() == nil && count != 0 {
16 frame.origin = NSZeroPoint
17 cell?.draw(withFrame: frame, in: self)
18 let iconSize = collectionSpace() != 0 ? collectionSpace() : 16
19 let opacity = collecting ? 1.0 : 0.75
20 let totalWidth = iconSize + 2
22 let object = collection.object(at: i) as! QSObject
23 var icon = object.icon()
24 let size = NSMakeSize(16, 16)
26 let inRect = NSMakeRect(
27 frame.size.width - totalWidth * CGFloat(count - i),
32 icon?.draw(in: inRect, from: rectFromSize(size), operation: .sourceOver, fraction: opacity)